<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

</body>
</html>
<script>
    //自定义一个事件
    var custom = new CustomEvent('事件名称','事件event对象');
    var custom = new CustomEvent('myevent',{
        target:'a',
        pageX:12,
        pageY:15,
        clientX:45,
        clientY:22,
        which:1,
            .......
    });
    //手动触发
    document.dispatchEvent(custom);
    //监听事件
    document.addEventListener('事件名称',function(){
        //执行某些操作
    })
</script>